#pragma once

#include "DrawElement.h"

class PFMEngine;

struct RECT_VERTEX
{
	D3DXVECTOR3	pos;
	D3DCOLOR	color;
	float		ft, fv;

	static const DWORD dwFVF;
};

class RectElement : public DrawElement
{
	friend class PFMEngine;
private:
	RectElement();
	~RectElement();

public:
	void	SetPos(float fx, float fy, float fWidth, float fHeight, float fTexLeft = 0.f, float fTexRight = 1.f, float fTexTop = 0.f, float fTexBottom = 1.f, float fAlpha = 1.f);
	void	SetColor(DWORD dwColor)					{ m_Color = dwColor; }

private:
	virtual void	Draw(LPDIRECT3DDEVICE9 pd3dDevice);

	bool	Create(LPDIRECT3DDEVICE9 pd3dDevice);
	void	SetTexture(LPDIRECT3DTEXTURE9 pTex)		{ m_pTexture = pTex; }
	void	Release();		

	LPDIRECT3DTEXTURE9			GetTexture()		{ return m_pTexture; }

private:
	LPDIRECT3DVERTEXBUFFER9		m_pVertexBuffer;
	LPDIRECT3DTEXTURE9			m_pTexture;
	D3DCOLOR					m_Color;	
};